﻿using ApplicationModels.A05.Reports;
using AutoMapper;
using Commons.Enums;
using Commons.Helpers;
using Commons.Responses;
using EntityModels.E05.Reports;
using IApplicationServices;
using IRepositories;

namespace ApplicationService
{
    public class CommentReportService : BaseApplicationService<int, CommentReport, CommentReportAM>, ICommentReportService
    {

        public CommentReportService(IBaseRepository<int, CommentReport> repository, IMapper mapper) : base(repository, mapper)
        {
        }

        public async Task<MessageResponse> ReportExamine(int id, ReportStatusEnum status)
        {
            var data = await Repository.GetAsync(id);
            if (data == null)
            {
                throw new CustomException("id不存在!");
            }
            data.Examine(status);
            return await Repository.UpdateAsync(data);
        }
        

    }
}
